<div class="page">
	<div class="page-header">
		<h3><i class="icon-awesome-table icon-large"></i><span class="divider"></span><?php echo __('Conta Contabils');?>&nbsp;<small>Lista de Contas Contábeis dos Bens Patrimoniais</small></h3>
		<div class='page-header-options pull-right'>
			<?php  echo $this->Html->link('<i class="icon-plus icon-white"></i>'.__('Add Conta Contabils'), array('action' => 'add'), array('id' => 'button-nova-conta', 'escape' => false, 'class' => 'btn btn-primary')); ?>
		</div>
	</div>
	<div class="page-content">	
	
			<?php echo $this->Form->create('Filter', array('class' => 'well')); ?>
				<div class="input-append">
	    			<?php echo $this->Form->input('Filter.descricao', array('type' => 'text', 'label' => false, 'div' => false, 'class' => 'span5', 'placeholder' => 'Digite a descrição da conta contábil')); ?>
	    			<?php echo $this->Form->button('<i class="icon-search icon-white"></i>&nbsp;Pesquisar', array('div' => false, 'class' => 'btn btn-primary', 'escape' => false)); ?>
  				</div>
			<?php echo $this->Form->end();?>
			
			<table class="table table-bordered table-striped">
			<thead>
			<tr>
				<th><?php echo $this->Paginator->sort('numero', 'Nº da Conta');?></th>
				<th><?php echo $this->Paginator->sort('descricao', 'Conta Contábil');?></th>
				<th class="actions"><?php echo __('Actions');?></th>
			</tr>
			</thead>
			<tbody>
			<?php
			foreach ($contaContabils as $contaContabil): ?>
			<tr>
				<td><?php echo h($contaContabil['ContaContabil']['numero']); ?>&nbsp;</td>
				<td><?php echo h($contaContabil['ContaContabil']['descricao']); ?>&nbsp;</td>
				<td class="actions">
					<?php echo $this->Html->link('<i class="icon-eye-open icon-white"></i>', array('action' => 'view', $contaContabil['ContaContabil']['id']), array('escape' => false, 'class' => 'btn btn-primary btn-mini')); ?>
					<?php echo $this->Html->link('<i class="icon-edit icon-white"></i>', array('action' => 'edit', $contaContabil['ContaContabil']['id']), array('escape' => false, 'class' => 'btn btn-primary btn-mini')); ?>
					<?php echo $this->Form->postLink('<i class="icon-trash icon-white"></i>', array('action' => 'delete', $contaContabil['ContaContabil']['id']), array('escape' => false, 'class' => 'btn btn-danger btn-mini'), __('Are you sure you want to delete # %s?', $contaContabil['ContaContabil']['id'])); ?>
				</td>
			</tr>
			<?php endforeach; ?>
			</tbody>
			</table>
	</div>
	<div class="page-footer">
		<div class="row-fluid">
			<div class="span5">
			<p>
			<?php
			echo $this->Paginator->counter(array(
			'format' => __('Página {:page} de {:pages}, exibindo de {:start} a {:end} de {:count} registros')
			));
			?>	</p>
			</div>
		
			<div class="span7 pagination">
				<ul>
				<?php
					echo $this->Paginator->prev(__('previous'), array('tag' => 'li'), null, array('class' => 'disabled', 'tag' => 'li'));
					echo $this->Paginator->numbers(array('separator' => '', 'tag' => 'li', 'currentClass' => 'active'));
					echo $this->Paginator->next(__('next'), array('tag' => 'li'), null, array('class' => 'disabled', 'tag' => 'li'));
				?>
				</ul>
			</div>
		</div>
	</div>
	
	<div id="modal-conta" class="modal hide fade" tabindex="-1"></div>
	
</div>

<script type="text/javascript">

	$(document).ready(function () {
		$('.actions > a.btn-primary').click(function(event){
			event.preventDefault();
			$("#modal-conta").html('');
			var url = $(this).attr('href');
            $.get(url, function (data) {
                $("#modal-conta").html(data);
                $("#modal-conta").modal();
            });
		});


		$('#button-nova-conta').click(function(event){
			event.preventDefault();
			$("#modal-conta").html('');
			var url = $(this).attr('href');
            $.get(url, function (data) {
                $("#modal-conta").html(data);
                $("#modal-conta").modal();
            });
		});
            
	});

</script>